package codeRandomThoughts.Test392判断子序列;

//双指针法
public class Solution {
    public boolean isSubsequence(String s, String t) {
        char[] charS = s.toCharArray();
        char[] charT = t.toCharArray();

        int i = 0;//指向s的指针
        int j = 0;//指向t的指针

        for (j = 0; j < charT.length; j++) {
            if (i < charS.length && charS[i] == charT[j]) {
                i++;
            }
        }

        return i == charS.length;
    }
}
